package com.changgou.goods.dao;

import com.changgou.goods.pojo.Brand;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * 品牌表的通用mapper
 * @author zhengjd
 * @date 2020/4/28 23:16
 */

public interface BrandMapper extends Mapper<Brand> {

    /**
     * 查询分类的品牌集合
     * @param categoryId
     * @return
     */
    @Select("select * from tb_brand tb where tb.id in (select tbc.brand_id from tb_category_brand tbc where tbc.category_id = #{categoryId} )")
    List<Brand> findByCategory(Integer categoryId);
}
